<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('终审办理')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">

<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-standingBook-edit" th:object="${standingBookVo}">
        <input name="p_B_isJudgment" id="isJudgment" type="hidden">
        <input name="id" th:field="*{id}" type="hidden">
        <input name="csry" th:field="*{csry}" type="hidden">
        <input type="hidden" name="p_COM_comment"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label ">编号：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{numberText}" type="text" name="numberText" id="numberText" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">项目名称：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{proName}" type="text" name="proName" id="proName" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">工程公司：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{compName}" type="text" name="compName" id="compName" readonly/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">商务经理：</label>
            <div class="col-sm-8">
                <input class="form-control" th:value="${createByName}" type="text" name="swjl" id="swjl" readonly  />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">审核内容：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{auditContent}" type="text" name="auditContent" id="auditContent" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">分包班组信息：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{teamInfo}" type="text" name="teamInfo" id="teamInfo" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">申请金额：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{applyMoney}" type="text" name="applyMoney" id="applyMoney" readonly />
            </div>
        </div>
        <h4 class="form-header h4">初审信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label ">结算审定金额：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{settlementMoney}" type="text" name="settlementMoney"
                       id="settlementMoney" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">核减值：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{reduceMoney}" type="text" name="reduceMoney" id="reduceMoney" readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">核减原因：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{reduceRate}" type="text" name="reduceRate" id="reduceRate"readonly />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">核减率：</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{reduceReason}" type="text" name="reduceReason"
                       id="reduceReason"readonly />
            </div>
        </div>
        <h4 class="form-header h4">终审信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">审批意见：</label>
            <div class="col-sm-8">
                <textarea rows="10" cols="15" name="comment" id="comment" class="form-control"></textarea>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-12" style="text-align: center; margin: 0 auto;">
                <a class="btn btn-success" onclick="cz(1)">通过</a>
                <a class="btn btn-danger" onclick="cz(2)">驳回</a>
                <a class="btn btn-primary" onclick="cz(3)">取消</a>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "settlement"
    var historyData;

    $(function () {
        var user = [[${user}]];
        $("#swjl").val(user.userName);
    });

    $("#form-standingBook-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-standingBook-edit').serialize());
        }
    }

    function getDataByTitle() {
        var id = $("#last").val();
        for (var i = 0; i < historyData.length; i++) {

            if (historyData[i].id == id) {
                $("#lastPlan").val(historyData[i].nextPlan);
            }
        }
        $("#missmodal1").click();
    }

    function again(again){
        $("#again").val(again);
        if ($.validate.form()) {
            var taskId = [[${taskId}]];
            $.operate.save(prefix + "/complete/" + taskId, $('#form-standingBook-edit').serialize());
        }
    }

    function cz(index) {
        if (index == 1) {
            $('input[name="p_B_isJudgment"]').val(true);
            $("#csry").val("");
        } else if (index == 2) {
            $('input[name="p_B_isJudgment"]').val(false);
        } else if (index == 3) {
            $.modal.close();
        }

        if ($.validate.form()) {
            if ($('textarea[name="comment"]').val()) {
                $('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
            }
            var taskId = [[${taskId}]];
            $.operate.save(prefix + "/complete/" + taskId, $('#form-standingBook-edit').serialize());
        }
    }


</script>
</body>
</html>
